package br.ufrn.btest.criterias;

import java.util.List;

public class TestPair {

	private int valueAIndex;
	private int valueBIndex;
	private String valueA;
	private String valueB;
	
	public TestPair(int valueAIndex, int valueBIndex, String valueA, String valueB) {
		this.valueAIndex = valueAIndex;
		this.valueBIndex = valueBIndex;
		this.valueA = valueA;
		this.valueB = valueB;
	}

	public int getValueAIndex() {
		return valueAIndex;
	}

	public int getValueBIndex() {
		return valueBIndex;
	}

	public String getValueA() {
		return valueA;
	}

	public String getValueB() {
		return valueB;
	}
	
	@Override
	public String toString() {
		return "(" + valueA + ", " + valueB + ")";
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof TestPair) {
			TestPair pair = (TestPair) obj;
			if(pair.getValueA().equals(this.getValueA())
					&& pair.getValueB().equals(this.getValueB())
					&& pair.getValueAIndex() == this.getValueAIndex()
					&& pair.getValueBIndex() == this.getValueBIndex()) {
					
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	public boolean isCoveredBy(List<String> combination) {
		boolean isValueAOnCombination = combination.get(getValueAIndex()).equals(getValueA());
		boolean isValueBOnCombination = combination.get(getValueBIndex()).equals(getValueB());
		
		if(isValueAOnCombination && isValueBOnCombination) {
			return true;
		} else {
			return false;
		}
	}
}
